<%@page import="Forum.ForumThreadForm"%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="/WebFinalProject/css/FinalProjectCSS.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="js/MasterJS.js"></script>
<script type="text/javascript">
	
	function commitAction() {
		//alert(document.forms[0].task.value);
		 if (!validateForm(document.forms[0])) {
			return;
		}
		document.forms[0].submit();
	}

	function hide() {
		if(document.forms[0].task.value == 'update') {
			document.getElementById('batchid').style.display = 'none';
			document.getElementById('classid').style.display = 'none';
		}
		if(document.forms[0].task.value == 'add') {
			document.getElementById('status').style.display = 'none';
		}
	}
</script>
<title>Manage Forum</title>
</head>
<html:javascript formName="forumThreadForm" dynamicJavascript="true" staticJavascript="true" method="validateForm" page="1"/>
<body onload="javascript:hide()">
	<center>
		<table width="100%" class="bodyTable boxShadow">
		
			<!-- Header -->
			<tr>
				<td colspan="2"><%@include file="/include/Header.jsp"%></td>
			</tr>
		
			<!-- Content -->
			<tr>
				<td rowspan="2" width="200px" class="navigationBox"><%@include file="/include/Navigation.jsp"%></td>
				<td align="left" class="headerBox blueBackground">Setting > 
					<a onclick="javascript:document.forms[0].reset();flyToPage('manageForum');">Manage Forum</a> > 
					<logic:equal value="add" property="task" name="forumThreadForm">Create Thread</logic:equal>
					<logic:notEqual value="add" property="task" name="forumThreadForm">Update Thread</logic:notEqual>
				</td>
			</tr>
			<tr>
				<td align="center"  class="contentStyle"><br>
					<html:form action="/Forum" method="post">
					<html:hidden property="task"/>
					<html:hidden property="fModel.forumThreadId"/>
					<br />
					<table width="50%" border="0" align="center" class="boxShadow">	
						<tr>
							<th align="center" colspan="4" class="headerBox formHeaderBackground">
								<logic:equal value="add" property="task" name="forumThreadForm">Create Thread</logic:equal>
								<logic:notEqual value="add" property="task" name="forumThreadForm">Update Thread</logic:notEqual>
							</th>
						</tr>
						<tr>
							<td style="vertical-align: middle; height:130px;">
								<table width="100%" align="center" style="border-spacing: 3px;">
									<tr id="batchid">
										<td class="formListStyle leftAlign">Batch</td>
										<td class="formListStyle" width="10px">:</td>
										<td class="formListStyle leftAlign">
											<html:select property="fModel.batchId" styleClass="comboStretch">
												<html:option value="">Select</html:option>									
												<logic:notEmpty name="forumThreadForm" property="listBatch">
													<html:optionsCollection name="forumThreadForm" property="listBatch" label="batchName" value="batchId"/>
												</logic:notEmpty>
											</html:select>
										</td>
									</tr>
									<tr id="classid">
										<td class="formListStyle leftAlign">Class</td>
										<td class="formListStyle">:</td>
										<td class="formListStyle leftAlign">
											<html:select property="fModel.classId" styleClass="comboStretch">
												<html:option value="">Select</html:option>									
												<logic:notEmpty name="forumThreadForm" property="listClass">
													<html:optionsCollection name="forumThreadForm" property="listClass" label="className" value="classId"/>
												</logic:notEmpty>
											</html:select>
										</td>
									</tr>
									<tr>
										<td class="formListStyle leftAlign">Thread Title</td>
										<td class="formListStyle">:</td>
										<td class="formListStyle leftAlign">
											<html:text name="forumThreadForm" property="fModel.threadTitle" styleClass="textStretch"></html:text>
										</td>
									</tr>
									<tr>
										<td class="formListStyle leftAlign">Description</td>
										<td class="formListStyle">:</td>
										<td class="formListStyle leftAlign">
											<html:text name="forumThreadForm" property="fModel.description" styleClass="textStretch"></html:text>
										</td>
									</tr>
									<tr id="status">
										<td class="formListStyle leftAlign">Status</td>
										<td class="formListStyle">:</td>
										<td class="formListStyle leftAlign">
											<html:select property="fModel.status" name="forumThreadForm" styleClass="comboStretch">
												<html:option value="open">Open</html:option>
												<html:option value="closed">Closed</html:option>
												<html:option value="hide">Hide</html:option>
											</html:select>
										</td>
									</tr>
			<!-- 						<tr> -->
			<!-- 							<td colspan="4" align="center" style="padding: 5px 7px;"><input type="button" class="buttonStyle" value="Save" onclick="javascript:commitAction()"/> &nbsp; <input type="button" class="buttonStyle" value="Cancel" onclick="javascript:flyToPage('manageForum')"/></td>  -->
			<!-- 						</tr> -->
								</table>
								<table align="center" style="border-spacing: 3px;">
									<tr>
										<td colspan="2" align="center" class="formListStyle">
											<table title="save" class="buttonStyle" style="cursor: pointer; width:75px;" onclick="javascript:commitAction();">
												<tr>
													<td style="vertical-align: middle;"><img src="images/saveButton.png"/></td>
													<td style="vertical-align: middle;"><b>&nbsp;Save&nbsp;</b></td>
												</tr>
											</table>
										</td>
										<td colspan="2" align="center" class="formListStyle">			
											<table title="cancel" class="buttonStyle" style="cursor: pointer; width:75px;" onclick="javascript:document.forms[0].reset();flyToPage('manageForum');">
												<tr>
													<td style="vertical-align: middle;"><img src="images/cancelButton.png"/></td>
													<td style="vertical-align: middle;"><b>&nbsp;Cancel&nbsp;</b></td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</html:form><br><br>
				</td>
			</tr>
			
			<!-- Footer -->
			<tr>
				<td align="center" colspan="2" class="headerBox blueBackground">&copy; OME. 2014. All Rights Reserved.</td>
			</tr>
		</table>
	</center>	
</body>
</html>